package main

import (
	"io/ioutil"
	"fmt"
	"encoding/json"
	"com.jinxiula/common"
)


func clientVersion(flag  chan<- bool){
	params:=common.Data()
	params["method"] = "web3_clientVersion"
	params["params"] = make([]interface{},0)
	resp:=common.Direct(params)
	defer resp.Body.Close()
	data,_:=ioutil.ReadAll(resp.Body)
	fmt.Println("2)返回的原始数据为:",string(data))
	var result common.Result
	if err:=json.Unmarshal(data,&result);err!=nil{
		 flag<-false
		 return
	}
	fmt.Println("3)返回的JSON结果：",result)
	flag<-true
}

func main() {
	result:=make(chan bool)
	go clientVersion(result)
	fmt.Println("查询结果为:",<-result)
}